<template>
	<view>
		<view class="header-box" :style="{ height: CustomBar + 'px',backgroundColor:bg }">
			<view class="status" :style="{ height: StatusBar + 'px' }"></view>
			<view class="header d_flex j_c a_c" :style="{ height: CustomBar - StatusBar + 'px' }">
				<view class="back" v-if="isBack" :style="{ height: CustomBar - StatusBar + 'px' }" @click="back"><u-icon name="arrow-left" size="18" :color="txtColor"></u-icon></view>
				<view class="title" :style="{color:txtColor }">{{ title }}</view>
			</view>
		</view>
		<view :class="isBord?'plac-box':'no-bord plac-box'" :style="{ height: (CustomBar+1) + 'px' }"></view>
	</view>
</template>

<script>
export default {
	name: 'self-header',
	props: {
		title: {
			type: String,
			default: '云上码'
		},
		bg:{
			type:String,
			default:'#ffffff'
		},
		txtColor:{
			type:String,
			default:'#000000'
		},
		isBord:{
			type:Boolean,
			default:true
		},
		isBack:{
			type:Boolean,
			default:true
		}
	},
	data() {
		return {
			StatusBar: this.StatusBar,
			CustomBar: this.CustomBar,
			ScreenHeight: this.ScreenHeight
		};
	},
	methods: {
		back() {
			uni.navigateBack();
		}
	}
};
</script>

<style lang="scss">
.header-box {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	background-color: #fff;
	z-index: 999;
	.header {
		padding: 0 30rpx;
		box-sizing: border-box;
		color: #000;
		font-size: 36rpx;
		align-items: center;
		position: relative;
		.back {
			position: absolute;
			top: 0;
			left: 0;
			width: 90rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			image {
				width: 32rpx;
				height: 32rpx;
			}
		}
		.title{
			width: 400rpx;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
			text-align: center;
			font-size: 28rpx;
		}
	}
}
.plac-box {
	width: 100%;
	border-bottom: 1px solid #e1e1e1;
	&.no-bord{
		border: none;
	}
}
</style>
